home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Magazine Collection 2001
/
Delphi Magazine Collection 20001 (2001).iso
/
DISKS
/
ISSUE23
/
CLINIC
/
MSGDLGS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1997-04-25
|
1KB
|
51 lines
unit MsgDlgs;
interface
uses
Forms, StdCtrls, Dialogs;
function MessageDlgDef(const Msg: string; AType: TMsgDlgType;
AButtons: TMsgDlgButtons; DefButton: TModalResult;
HelpCtx: Longint): TModalResult;
function MessageDlgDefPos(const Msg: string; AType: TMsgDlgType;
AButtons: TMsgDlgButtons; DefButton: TModalResult;
HelpCtx: Longint; X, Y: Integer): TModalResult;
implementation
function MessageDlgDef(const Msg: string; AType: TMsgDlgType;
AButtons: TMsgDlgButtons; DefButton: TModalResult;
HelpCtx: Longint): TModalResult;
begin
Result := MessageDlgDefPos(Msg, AType, AButtons,
DefButton, HelpCtx, -1, -1);
end;
function MessageDlgDefPos(const Msg: string; AType: TMsgDlgType;
AButtons: TMsgDlgButtons; DefButton: TModalResult;
HelpCtx: Longint; X, Y: Integer): TModalResult;
var
I: Integer;
begin
Result := 0;
with CreateMessageDialog(Msg, AType, AButtons) do
try
HelpContext := HelpCtx;
if X > -1 then Left := X;
if Y > -1 then Top := Y;
ScaleBy(Screen.PixelsPerInch, 96);
{ Change the default button }
for I := 0 to Pred(ComponentCount) do
if Components[I] is TButton then
if TButton(Components[I]).ModalResult = DefButton then
ActiveControl := TButton(Components[I]);
Result := ShowModal;
finally
Free;
end;
end;
end.